<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"  prefix="c"%>
<%@ taglib prefix="f" uri="http://www.springframework.org/tags/form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
	String path=request.getContextPath();
%>    

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
	<link href="/resources/css/bootstrap-4.3.1/css/bootstrap.css" rel="stylesheet">
	<script type="text/javascript" src="/resources/js/jquery-3.2.1/jquery.js"></script>
	<script type="text/javascript" src="/resources/js/jqueryvalidate/jquery.validate.js"></script>
	<script type="text/javascript" src="/resources/js/jqueryvalidate/localization/messages_zh.js"></script>
	<script type="text/javascript" src="/resources/css/bootstrap-4.3.1/js/bootstrap.js"></script>
	
</head>
<body>
	<a href = "toAddPro"><button type="button" class="btn btn-primary">发布项目</button></a>

	<table class = "table">
		<tr>
			<td>主键</td>
			<td>项目名称</td>
			<td>投资金额</td>
			<td>分管领导</td>
			<td>部门</td>
			<td>操作</td>
			
		</tr>
		<!-- //Plan p = new Plan(id, proname, money, promanager, departid, details) -->
		<c:forEach items="${planPage.list }" var="plan">
			<tr>
				<td>${plan.id }</td>
				<td>${plan.proname }</td>
				<td>${plan.money }</td>
				<td>${plan.promanager }</td>
				<td>${plan.company.department }</td>
				<td><a href="showDetail?id=${plan.id }">查看详情</a></td>
			</tr>
		</c:forEach>
	</table>
	
	<nav aria-label="Page navigation example">
	  <ul class="pagination">
	    <li class="page-item">
	      <a class="page-link" href="findPlan?pageNum=1" aria-label="Previous">
	        <span aria-hidden="true">&laquo;</span>
	      </a>
	    </li>
	    <c:forEach begin="${planPage.pageNum-2>1?planPage.pageNum-2:1}" 
       end="${planPage.pageNum+2<planPage.pages ? planPage.pageNum+2:planPage.pages}" step="1" var="page">
    	<c:if test="${page==planPage.pageNum}">
    		<li class="page-item active" aria-current="page">
		      <a class="page-link" href = "findPlan?pageNum=${page}">
		         ${page}
		       
		      </a>
		    </li>
    	</c:if>
    	<c:if test="${page!=planPage.pageNum}">
    		<li class="page-item"><a class="page-link" href="findPlan?pageNum=${page}" >${page}</a></li>
    	</c:if>
    	
    </c:forEach>
	    
	    <li class="page-item">
	      <a class="page-link" href="findPlan?pageNum=${planPage.pages }" aria-label="Next">
	        <span aria-hidden="true">&raquo;</span>
	      </a>
	    </li>
	  </ul>
	</nav>
</body>
</html>